package com.rchat.pocmini.global;

import android.text.TextUtils;

/**
 * Created by itsdf07 on 2017/8/29.
 */

public class UrlsGlobal {
    /**
     * {@code 测式地址} true<br/>{@code 正式地址} false
     */
    private static boolean isTestService = false;
    /**
     * 服务器地址
     */
    private static final String BASE_HOST = "121.199.44.234";
    private static final String BASE_HOST_TEST = "192.168.0.77";

    /**
     * 服务器端口
     */
    private static final String BASE_PORT = "9381";
    private static final String BASE_PORT_TEST = "8080";

    /**
     * 申请睿洽支付流水单号
     */
    public static final String APPLY_RCHAT_TRADE_NO_URL = "ROPplatform/weChatPay";
    /**
     * 短信验证码地址
     */
    public static final String GET_VERIFICATION_CODE_URL = "ROPplatform/send";
    /**
     * 账号注册地址
     */
    public static final String REGISTER_URL = "ROPplatform/register";
    /**
     * 登录地址
     */
    public static final String LOGIN_URL = "ROPplatform/login";
    /**
     * 忘记密码地址
     */
    public static final String RESET_PWD_URL = "ROPplatform/resetPWD";
    /**
     * 创建群组测试地址
     */
    public static final String CREATE_GROUP_URL = "ROPplatform/chatgroup";
    /**
     * 搜索群组测试地址
     */
    public static final String SEARCH_GROUP_URL = "ROPplatform/chatgroup";
    /**
     * 好友列表
     */
    public static final String QUERY_FRIEND_LIST = "ROPplatform/obtainFriendsList";
    /**
     * 搜索好友
     */
    public static final String QUERY_FRIEND = "ROPplatform/searchFriend";
    /**
     * 扫描好友
     */
    public static final String SCAN_FRIEND = "ROPplatform/applyFriend";
    /**
     * 添加好友
     */
    public static final String ADD_FRIEND = "ROPplatform/applyFriend";
    /**
     * 删除好友
     */
    public static final String DEL_FRIEND = "ROPplatform/deleteFriend";
    /**
     * 邀请好友加入群聊
     */
    public static final String INVITE_FRIEND_TO_GRPOUP = "ROPplatform/inviteMember";
    /**
     * 退出频道
     */
    public static final String DEL_GRPOUP = "ROPplatform/deleteGroup";
    /**
     * 申请加入群组
     */
    public static final String APPLY_JOIN_GROUP = "ROPplatform/applyToGroup";
    /**
     * 修改昵称
     */
    public static final String CHANGE_NICKNAME = "ROPplatform/modify";
    /**
     * 同意加好友
     */
    public static final String AGREE_ADD_FRIEND = "ROPplatform/applyFriend";
    /**
     * 查询加好友推送
     */
    public static final String QUERY_ADD_FRIEND_PUSH = AGREE_ADD_FRIEND;
    /**
     * 查询申请加入群组推送
     */
    public static final String QUERY_APPLY_GROUP_PUSH = "ROPplatform/applyToGroup";
    /**
     * 同意加入群组
     */
    public static final String AGREE_JOIN_GROUP = "ROPplatform/applyToGroup";
    /**
     * 修改群组名称
     */
    public static final String MODIFY_GROUP_NICKNAME_URL = "ROPplatform/modify";
    /**
     * 上传经纬度接口（正式服务器）
     */
    public static final String REPORT_LOCATION_URL = "http://121.199.44.234:8883/api/location/addlocation";
    /**
     * 地图定位查询接口（正式服务器）
     */
    public static final String QUERY_LOCATION_LIST = "http://121.199.44.234:8883/api/location/clist";
    /**
     * 获取蓝牙设备数据接口
     */
    public static final String SEARCH_BT_DEVICE = "ROPplatform/bluetooth";
    /**
     * 绑定蓝牙设备数据接口
     */
    public static final String BIND_BT_DEVICE = "ROPplatform/bluetooth";
    /**
     * 查询充值记录接口
     */
    public static final String QUERY_RECHARGE_RESULT = "ROPplatform/searchOrder";
    /**
     * 查询更新
     */
    public static final String CHECK_UPDATE = "ROPplatform/update";
    /**
     * 查询推送消息
     */
    public static final String QUERY_PUSH_MESSAGE = "ROPplatform/login";
    /**
     * 查询价格定义表
     */
    public static final String QUERY_PRICE_LIST = "ROPplatform/producePrice";
    /**
     * 查询频道成员
     */
    public static final String QUERY_GROUP_MEMBER = "ROPplatform/chatgroup";
    /**
     * 获取没有在当前频道的好有
     */
    public static final String QUERY_FRIEND_NOT_IN_GROUP = "ROPplatform/applyToGroup";
    /**
     * 修改密码
     */
    public static final String CHANGE_PASSWORD = "ROPplatform/modify";
    /**
     * 检查account
     */
    public static final String CHECK_ACCOUNT = "ROPplatform/register";
    /**
     * 查询邀请群组推送、答复交好友推送、答复申请加入群组推送
     */
    public static final String QUERY_REPLY_PUSH = "ROPplatform/jpushUpdate";
    /**
     * 查询账号到期时间
     */
    public static final String QUERY_ACCOUNT_DATE = "ROPplatform/properties";
    /**
     * 邀请好友监听群组
     */
    public static final String QUERY_ACCOUNT_APOLLO_PUSH_CALL = "ROPplatform/apolloPushCall";

    /**
     * VIP会员到期后用户选择保留群组接口
     */
    public static final String RUL_UNVIP_EXPIRY = "ROPplatform/expiry";

    /**
     * 位置上报接口
     */
    public static final String LOCATION_REPORT = "ROPplatform/location";

    /**
     * 蓝牙设备绑定：激活 + 绑定设备
     */
    public static final String URL_DEVICE_BLUETOOTH = "ROPplatform/doBluetooth";

    /**
     * 获取URL地址
     *
     * @param value ROPplatform/bluetooth
     * @return
     */
    public static String getUrl(String value) {
        if (TextUtils.isEmpty(value)) {
            //http://121.199.44.234:9381
            return String.format("http://%1$s:%2$s", BASE_HOST, BASE_PORT);
        }
        if (isTestService) {
            //http://192.168.0.99:8080/ROPplatform/bluetooth
            return String.format("http://%1$s:%2$s/%3$s", BASE_HOST_TEST, BASE_PORT_TEST, value);
        } else {
            //http://121.199.44.234:9381/ROPplatform/bluetooth
            return String.format("http://%1$s:%2$s/%3$s", BASE_HOST, BASE_PORT, value);
        }
    }
}
